#include<stdio.h>
#include<string.h>
#include<strings.h>
int main()
{
    //freopen("in.txt","r",stdin);
    char str[15];
    char str2[100];
    scanf("%s",str);
    int ans = 0;
    while (scanf("%s",str2) != EOF)
    {
        if(strcasecmp(str,str2) == 0) ans++;
    }
    printf("%d",ans);
    
}